#include "list_button.h"

#include <QLabel>
#include <QVBoxLayout>
#include <QLineEdit>
#include <QDoubleValidator>

list_button::list_button(QWidget* parent)
    : QPushButton(parent),clicks(0)
{
    image = new QLabel;
    image->setFixedWidth(15);
    image->setScaledContents(true);//图像缩放
    text = new QLabel;
    QHBoxLayout* mainLayout = new QHBoxLayout;
    mainLayout->addWidget(image);
    mainLayout->addWidget(text);
    this->setLayout(mainLayout);
    init();
}

void list_button::init()
{
    this->SetImageLabel(QPixmap(":/new/prefix1/images/456.jpg"));
    this->SetTextLabel("默认分组");
}

void list_button::SetImageLabel(const QPixmap &pixmap)
{
    image->setPixmap(pixmap);
}

void list_button::SetTextLabel(QString new_text)
{
    text->setText(new_text);
}

QLabel* list_button::GetImageHandle()
{
    return image;
}

QLabel* list_button::GetTextHandle()
{
    return text;
}


